//
//  UpdateModel.m
//  Courses
//
//  Created by YiXuePxh on 15/4/7.
//  Copyright (c) 2015年 boyibang. All rights reserved.
//

#import "UpdateModel.h"
#import "Request.h"
@implementation UpdateModel

-(id)initWithJson:(id)jsonArray{
    self.TheNewVersion = jsonArray[@"newVersion"];
    self.forceUpdate = jsonArray[@"forceUpdate"];
    self.name = jsonArray[@"name"];
    self.descrip = jsonArray[@"description"];
    self.version = jsonArray[@"version"];
    self.url = jsonArray[@"url"];
    return self;
}
+(UpdateModel* )getUpdateData{
    UpdateModel* update;
    Request* request = [Request requestWithName:@"get_current_version"];
    Response* response = [request response];
    if (response.result) {
        if ([response.content[@"version"] isKindOfClass:[NSDictionary class]]) {
            update = [[UpdateModel alloc]initWithJson:response.content[@"version"]];
        }
    }
    return update;
}

@end
